/**
 * description:翻页时调用 curPageNo:当前页数 actionName:action名称 method：方法名称
 */
function go(curPageNo, curPageNoHidParam, actionName, method) {
	document.getElementById(curPageNoHidParam).value = curPageNo;
	var isFirstQueryParam = curPageNoHidParam.substring(0, curPageNoHidParam
			.indexOf("."));
	isFirstQueryParam = isFirstQueryParam + ".isFirstQuery";
	document.getElementById(isFirstQueryParam).value = "N";
	chgAction(actionName, method);
	showBar();
	document.forms[0].submit();
}

/**
 * description:将分页的页数置为首页 formName:form名称
 */
function initPage(formName) {
	var para = formName + ".isFirstQuery";
	document.getElementById(para).value = "";
}

/**
 * 改变action提交的method
 * 
 * @param actionName
 * @param method
 */
function chgAction(actionName, method) {
	document.forms[0].action = actionName + "!" + method + ".action";
}

//改變action提交的method並帶request傳參，參數之間"&"分隔
function chgActionParams(actionName, method, requestParams) {
	showBar();
	var action = actionName + "!" + method + ".action";
	if (requestParams !== null && requestParams !== "") {
		action += "?" + requestParams;
	}
	document.forms[0].action = action;
}
//改變action提交的method並帶request傳參，參數之間"&"分隔
function chgActionParamsNoShowBar(actionName, method, requestParams) {
	var action = actionName + "!" + method + ".action";
	if (requestParams !== null && requestParams !== "") {
		action += "?" + requestParams;
	}
	document.forms[0].action = action;
}

/**
 * 显示遮挡层
 */
function showBar() { 
	bui 
	.blockUI({
				message : '<img src="\images/common/load.gif" /> <font size="2" style="font-family: 微软雅黑">处理中，请稍候...</font>',
				css : {
					backgroundColor : '#FFFFFF',
					height : '40px',
					width : '200px',
					top : '20%',
					left : '40%',
					textAlign : 'center'
				}
			});
}

/**
 * 隐藏遮挡层
 */
function hideBar() {
	bui.unblockUI();
}

//去掉前后空白
function trimVal(val){
	if (!val) {
		return "";
	}
	return val.replace(/(^\s*)|(\s*$)/g,"");
}